-
Notifications
You must be signed in to change notification settings - Fork 549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle duplicate SF in coverage.info to make sure coverage.xml gets correct statistics #3482
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run Azure.sonic-swss |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
This coverage.zip contains the coverage.info and buggy coverage.xml obtained from artifacts of PR#3242, without the change of this PR#3482. you can check by searching But in What this #PR3482 wants to fix is that, use --add-trace-file option for lcov, so that it could sum up all |
The best fix for this is to rework the automake build files to not need to compile the same files repeatedly. This probably involves switching to non-recursive automake, and takes a bit of time to do so without breaking anything. This is a good enough short-term fix, at least. |
What I did
use
--add-tracefile
option indebian/rules
andtests/conftest.py
to sanitizecoverage.info
generated bylcov
Why I did it
lcov
generates an initialcoverage.info
file based on collected.gcno
and.gcda
files, this.info
file contains coverage information for different source files (marked asSF
). Sometimes you would observe that the sameSF
appears multiple times, it meanslcov
gets multiple copies of coverage information for this file, since this file may have appeared in multiple compilation units, and for each copy, the hit times of its lines are different.Then
lcov_cobertura
generatescoverage.xml
based oncoverage.info
. However, it can't deal with duplicate SF incoverage.info
properly. If it sees duplicate coverage information for a source file fromcoverage.info
, it always overwrites the old copy with the new copy, hence only the last copy would be counted. However, if the last copy considers the functions as missing, the function is considered as missing incoverage.xml
, which is used to determine whether the new PR passes the coverage threshold.The proper way is to add the hit times of all the copies, which could be achieved by lcov
add-tracefile
option.How I verified it
Before using
--add-tracefile
, RingBuffer related functions in this PR are considered missing, though they are covered in testcases. After adding--add-tracefile
, it passes the coverage check.[orchagent] implement ring buffer feature with a flag #3242
Details if related
By downloading the artifact of PR#3242, we could check coverage.xml, which has already had the correct statistics.